// Swarm Model
// by Mina Jung @ syracuse university
// April 2010


#import <tossim.h>
#import "Sensor.h"
#import "SensorSpace.h"
#import <space.h> // Grid2d
#import <random.h> // random number generator
#import <objectbase/Swarm.h>
#import <vector>

using namespace std;

@interface TossimModelSwarm: Swarm
{
  int numSensors;				  // simulation parameters
  int numApplications;				  // simulation parameters
  int numEnvironmentType;

  int currentTime;

  /*
   * in order to manage applications, (application id and its name) pair 
   * vector structure?? of c++
   * or List of ObjectC ???
   * BUT, right now -- simple array!!
   */

  std::vector<char *> applications;


  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  //          EMS TOSSIM related
  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  double maxBattery;

  Tossim *tossim;
  Radio  *radio;

  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  //          Environmental Variables of EMS TOSSIM 
  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  FILE *envF;


  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  int worldXSize, worldYSize;

  BOOL randomizeNodeUpdateOrder;
  
  int randomEnvironmentSet;


  id <ActionGroup> modelActions;	          // scheduling data structures
  id <Schedule> modelSchedule;
  id actionForEach;                               // for frobbing randomization

  id <List> moteList;			  	  // list of all motes 

  id <ListShuffler> shuffler;


  id <UniformIntegerDist> uniformInt;


  id <List> appList;				  // list of all applications	
  id <Grid2d> world;				  // objects representing
  SensorSpace *sensorSpace;				  // the world
}

- getSensorList;			          // access methods into the
- (id <Grid2d>)getWorld;			  // model swarm. These methods
- (SensorSpace *)getSensorSpace;                           // allow the model swarm to
						  // be observed.
- (BOOL)toggleRandomizedOrder;                    // method to toggle the
                                                  // randomization feature
- addNewSensor: (Sensor *)mote;			  // special method for demo

+ createBegin: aZone;				  // extra methods you
- createEnd;					  // provide for Swarms
- buildObjects;
- buildActions;
- (id <Activity>)activateIn: swarmContext;

  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  //          EMS TOSSIM related
  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++

- updateTossim: (int)sec;
- updateEnvironment: (int)sec;
- (int)getRandomIntMin: (int)min Max: (int)max;
- changeMoteBatteryCapID: (int)idx Value: (double)bat;
- setApplications;
- setTopology;
- setNoiseInterference;
- setSensorNodes;
- setEnvironmentalFiles;


@end
